home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / sg3-utils / README.sg_start < prev   
Encoding:
Text File  |  2004-05-07  |  1.2 KB  |  38 lines

  1. Hi,
  2.  
  3. you can use sg_start to start (spin-up, 1) and stop (spin-down, 0) devices.
  4. I also offers a parameter (-s) to send a synchronize cache command to a
  5. device, so it should write back its internal buffers to the medium.
  6.  
  7. Be aware that the Linux SCSI subsystem at this time does not autmatically
  8. starts stopped devices, so stopping a device which is in use may have fatal
  9. results for you.
  10.  
  11. So, you should apply with care.
  12. I use it in my shutdown script at the end (before the poweroff command):
  13.  
  14. # SG_SHUG_NOS is set in my config file rc.config
  15. # SG_SHUT_NOS="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
  16. if test -x /bin/sg_start; then
  17.     if test "`basename $command`" = "reboot"; then
  18.         for no in $SG_SHUT_NOS;
  19.           do /bin/sg_start /dev/sg$no -s >/dev/null 2>&1; 
  20.      done
  21.     else
  22.         for no in $SG_SHUT_NOS;
  23.         do /bin/sg_start /dev/sg$no -s 0 >/dev/null 2>&1;
  24.         done
  25.     fi
  26. fi
  27.  
  28. Enjoy!
  29.                     Kurt Garloff <garloff at suse dot de>
  30.  
  31.  
  32. Postscript
  33. ==========
  34. sg_start has been reworked to allow a block device (e.g. /dev/sda) in
  35. addition to the sg device name (e.g. /dev/sg0) in the lk 2.6 series.
  36. sg_start now has more command line options, see its man page.
  37.     Doug Gilbert <dgilbert at interlog dot com> 2004/5/8
  38.